package vip.meeet.algorithm.dp;


public class Num392 {

    public static void main(String[] args) {
        String s = "abc";
        String t = "ahbgdc";
        System.out.println(isSubsequence(s,t));
        indexInt();
    }

    public static void indexInt(){
                String s = "ahbgdc";
        int cint = (int)'a';
//        int cint = (int)'g';
        System.out.println(s.indexOf(cint));
        System.out.println(s.indexOf(cint,4));
    }

    public static boolean isSubsequence(String s, String t) {
        int fromIndex = 0;
        for(int i=0;i<s.length();i++){
            int cint = (int) s.charAt(i);
            int index = t.indexOf(cint,fromIndex);
            if(index == -1){
                return false;
            }
            fromIndex = index + 1;
        }
        return true;
    }


}
